package com.wise.mall.portal.dao.ums.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.wise.mall.portal.dao.ums.MemberDao;
import com.wise.mall.ums.entity.Member;
import com.wise.mall.ums.mapper.MemberMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @author shiweinan
 */
@Repository
public class MemberDaoImpl implements MemberDao {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public Member getByUsername(String username) {
        LambdaQueryWrapper<Member> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(Member::getUsername, username);
        wrapper.last("limit 1");
        return memberMapper.selectOne(wrapper);
    }
}
